package com.starview.platform.data.type;

import java.util.Map;

import com.starview.star.compiler.util.PrettyPrintable;

/**
 * A TypeInterface is an abstract environment in which fields may be defined, as well as types being
 * defined.
 * 
 * @author fgm
 * 
 */
public interface TypeInterface extends PrettyPrintable
{
  /**
   * Get the type of an individual field in the interface
   * 
   * @param name
   * @return null if name not defined, otherwise the type associated with the field
   */
  IType getFieldType(String name);

  /**
   * All the fields in this interface.
   * 
   * @return a Map of all the fields in the interface
   */
  Map<String, IType> getAllFields();

  /**
   * How many fields are there? It may be cheaper to compute this than sizing the map of fields.
   * 
   * @return the number of fields in this TypeInterface
   */
  int numOfFields();

  /**
   * Pick up the specification of an individual type
   * 
   * @param name
   * @return null if the type is not known, otherwise its specification
   */
  IType getType(String name);

  /**
   * All the types defined in this interface
   * 
   * @return
   */
  Map<String, IType> getAllTypes();

  /**
   * How many types are defined in this TypeInterface?
   * 
   * @return
   */
  int numOfTypes();
}
